package com.lxn.web.controller;

import com.lxn.hrm.util.AjaxResult;
import com.lxn.utils.RedisUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/redis")
public class RedisController {

    //设置值
    @PostMapping("/set")
    public AjaxResult set(@RequestParam("key") String key , @RequestParam("value") String value){
        RedisUtils.INSTANCE.set(key , value);
        return AjaxResult.me();
    }

    //获取值
    @GetMapping("/get/{key}")
    public AjaxResult get(@PathVariable("key") String key){
        String result = RedisUtils.INSTANCE.get(key);
        return AjaxResult.me().setResultObj(result);
    }

}

